﻿IF EXISTS (SELECT * from sys.procedures p left join sys.schemas s on p.schema_id = s.schema_id where p.name='reference_update' and s.name='Meta')
DROP PROCEDURE [Meta].reference_update
GO
CREATE PROCEDURE [Meta].reference_update 
@PK uniqueidentifier, 
@LastUpdate datetime, 
@Google nvarchar(32), 
@GoogleLastUpdate datetime, 
@ZohoCRM int, 
@ZohoCRMLastUpdate datetime, 
@From nvarchar(50), 
@Validated bit
AS
BEGIN
UPDATE [Meta].[References] 
SET	[last_update] = @LastUpdate ,
	[Google] = @Google ,
	[Google_last_update] = @GoogleLastUpdate ,
	[ZohoCRM] = @ZohoCRM ,
	[ZohoCRM_last_update] = @ZohoCRMLastUpdate ,
	[from] = @From ,
	[Validated] = @Validated 
WHERE
	[id_reference] = @PK 
END